returntype functionName(datatype args1,datatype args2,...) { Statements --------------- return value ; }
class demo { public static void main(String args[]) { System.out.println(“CCIT”); star(); System.out.println(“\nAmravati”); star(); } static void star() { for( int i=1;i<=50;i++) System.out.print("*"); } }
CCIT ************************* Amravati *************************
class demo { public static void main(String args[]) { display(); } static void display() { for(int i=1;i<=100;i++) System.out.print(i+" "); } }
class demo { public static void main(String args[]) { odd(); } static void odd() { for(int i=1;i<=100;i+=2) System.out.print( i + " "); } }